<layout name="page" />
<block name="content">
	{:widget('page_header/sub',array('name'=>'项目信息'))}
	<div class="frame">
		<div class="box col-12">
			<label class="input-label" for="name">标题*：</label>
			<div class="input-box">
				{$project.name}
			</div>
		</div>
		<div class="box col-12">
			<label class="input-label" for="name">日期*：</label>
			<div class="input-box">
				{$project.start_date} ~ {$project.end_date}
			</div>
		</div>
		<div class="box col-12">
			<label class="input-label" for="name">项目成员：</label>
			<div class="input-box">
				{$project.member|show_contact}
			</div>
		</div>
		<div class="box col-12">
			<label class="input-label" >项目描述：</label>
			<div class="content-wrap">
				{$project.content}
			</div>
		</div>
		<div class="box col-12">
			<label class="input-label" >附件：</label>
			{:widget('file_upload/view',array('add_file'=>$project['add_file']))}
		</div>
	</div>
	{:widget('page_header/sub',array('name'=>'新建任务'))}
	<div class="frame">
		<form method='post' id="form_data" name="form_data" enctype="multipart/form-data"  >
			<input type="hidden" name="ajax" id="ajax" value="1">
			<input type="hidden" name="opmode" value="add">
			<input type="hidden" name="executor" id="executor" value="">
			<input type="hidden" name="project_id" id="project_id" value="{$project_id}">
			<div class="box col-12">
				<label class="input-label" for="name">任务标题*</label>
				<input class="input" type="text" id="name" name="name" check="required" info="请输入标题">
			</div>
			<div class="box col-12">
				<label class="input-label" for="executor_id">执行人：</label>
				<select class="select w16" id="executor_id" name="executor_id" check="required" info="请选择执行人">
					<option>请选择</option>
					{:fill_option($member_list)}
				</select>
				<i class="icon"></i>
			</div>
			<div class="box col-12">
				<label class="input-label" for="workload">工作量：</label>
				<input class="input w6" type="text" id="workload" name="workload" check="number" info="必须是数字">
			</div>
			<div class="box col-12">
				<label class="input-label" for="end_date">截至日期*：</label>
				<input type="text" id="end_date" name="end_date" readonly="readonly" class="input input-date" check="required" info="请选择截至日期">
			</div>
			<foreach name="field_list" val="udf_vo">
				{:widget('user_defind_field/edit',array($udf_vo))}
			</foreach>
			<div class="box col-12">
				<label class="input-label" >任务描述：</label>
				<textarea class="textarea simple" style="height:200px;" id="content" name="content"></textarea>
			</div>
			<div class="box col-12">
				<label class="input-label" >附件：</label>
				{:widget('file_upload/add',array('name'=>'task_file'))}
			</div>
			<div class="box col-12">
				<label class="input-label" >附件：</label>
				<a class="btn btn-normal" onclick="save()">保存</a>
				<a class="btn btn-return"onclick="go_return_url();">取消</a>
			</div>
		</form>
	</div>
</block>
<block name="js">
	<script type="text/javascript">
		layui.use(['global', 'uploader', 'editor'], function() {
			var fn = {
				save : function() {
					send_form("form_data", "{:url('save_task')}", '{:url("read",array("id"=>$project_id))}', function(ret) {
						if (ret.status) {
							layer.msg(ret.info, {
								time : 1200
							}, function() {
								location.href = '{:url("read",array("id"=>$project_id))}';
							});
						} else {
							layer.msg(ret.info);
							return false;
						}
					});
				}
			};
			win_exp(fn);
		});
	</script>
</block>